package com.gitee.xhs;

import com.gitee.xhs.sampleRecod.transactionRecord.Transaction;
import org.apache.flink.api.common.eventtime.Watermark;
import org.apache.flink.api.common.eventtime.WatermarkGenerator;
import org.apache.flink.api.common.eventtime.WatermarkOutput;

/**
 * @author BigHead
 * @date 2022/7/18 11:27
 * @description CustomDefaultWatermarkGenerator
 */
public class CustomDefaultWatermarkGenerator implements WatermarkGenerator<Transaction> {

    public static final String CUSTOM_DEFAULT_WATERMARK_GENERATOR = "CustomDefaultWatermarkGenerator";

    @Override
    public void onEvent(Transaction event, long eventTimestamp, WatermarkOutput output) {
        output.emitWatermark(new Watermark(event.getTimestamp()));
    }

    @Override
    public void onPeriodicEmit(WatermarkOutput output) {
    }

}
